# -*- coding: utf-8 -*-
from django.conf.urls.defaults import *
from django.contrib.auth.decorators import login_required
from news.views import NewsByCategory, NewsList, NewsDetail, NewsCreateView, NewsUpdateView, CategoryCreate, NewsDeleteView, CategoryDeleteView, CategoryList, CategoryUpdate

urlpatterns = patterns('',
    url(r'^$', NewsList.as_view(), name="news_list"),
    url(r'^create/$', login_required(NewsCreateView.as_view()), name="news_create"),
    url(r'^createcat/$', login_required(CategoryCreate.as_view()), name="cat_create"),
    url(r'^catlist/$', login_required(CategoryList.as_view()), name="cat_list"),
    url(r'^delete/(?P<pk>[-\w]+)/$', login_required(NewsDeleteView.as_view()), name="news_delete"),
    url(r'^deletecat/(?P<pk>[-\w]+)/$', login_required(CategoryDeleteView.as_view()), name="category_delete"),
    url(r'^update/(?P<pk>[-\w]+)/$', login_required(NewsUpdateView.as_view()), name="news_update"),
    url(r'^updatecat/(?P<pk>[-\w]+)/$', login_required(CategoryUpdate.as_view()), name="category_update"),
    url(r'^(?P<arg>[-\w]+)/(?P<pk>[-\w]+)/$', NewsDetail.as_view(), name="news_detail"),
    url(r'^(\w+)/$', NewsByCategory.as_view()),
)

